package com.atguigu.crowd.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


@Configuration
public class MyConfig extends WebMvcConfigurationSupport {
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("static/**").addResourceLocations("classpath:/static/");
        registry.addResourceHandler("templates/**").addResourceLocations("classpath:/templates/");
    }

    @Override
    protected void addViewControllers(ViewControllerRegistry registry) {
        // 浏览器访问的地址  目标视图的名称  添加一个viewController
        registry.addViewController("/auth/login/success").setViewName("member");


//        registry.addViewController("/").setViewName("portal");
        registry.addViewController("/auth/welcome/member-login").setViewName("member-login");
        registry.addViewController("/auth/welcome/member/to/reg/page.html").setViewName("member-reg");
        registry.addViewController("/auth/welcome/member/register").setViewName("member-reg");
        registry.addViewController("/auth/login/my/crowding").setViewName("mine-crowd");
        registry.addViewController("/auth/login/success").setViewName("member");
    }
}
